#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	int n, min, max,num=0;
	cin >> n;
	int a[1000];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	sort(a, a + n);
	min = a[0];
	max = a[n-1];
	num = max - min;
	cout << num << endl;
	return 0;
}